var arr = [1, 2, 4, 1, 5, 2];
//数组去重一
const newArr = arr.reduce((acc, n, i) => {
  return [].concat(acc, arr.indexOf(n) == i ? n : [])
})
//数组去重二
const newArr2 = Array.from(new Set(arr));
//数组去重三
const newArr3 = arr.filter((n, i) => {
  return arr.indexOf(n) === i;
})

const newArr4 = arr.forEach((n, i) => {
  return arr.indexOf(n) == i
})


console.log(newArr4);